Fix input encoding and error parsing for HTTP calls.#428
Conversation
| return OBJECT_MAPPER.readValue(json, DaprError.class); | ||
| } catch (JsonParseException e) { | ||
| throw new DaprException("UNKNOWN", new String(json, StandardCharsets.UTF_8)); | ||
| } |
There was a problem hiding this comment.
Is this supposed to be here? What are the cases where this is called?
There was a problem hiding this comment.
This can happen if Dapr does not unescape correctly and returns a bad response at the HTTP server prior to the request being processed by dapr logic. I reproduced this with daprd with a bad patch from another PR - so I thought it would be good to have a better experience in the SDK if that kind of corner case happens.
| String urlDeleteState = DaprClientHttp.STATE_PATH + "/" + deletedStateKey; | ||
| String urlExistingState = DaprClientHttp.STATE_PATH + "/" + existingState; | ||
| String urlDeleteState = STATE_PATH + "/" + deletedStateKey; | ||
| String urlExistingState = STATE_PATH + "/" + existingState; |
There was a problem hiding this comment.
It seems little wierd to do the work in the tests of building a path and then splitting it again because the API takes string[]
There was a problem hiding this comment.
It was to minimize changes.
wcs1only
left a comment
There was a problem hiding this comment.
Thanks for adding a test.
Codecov Report
@@ Coverage Diff @@
## master #428 +/- ##
============================================
- Coverage 83.40% 83.29% -0.11%
- Complexity 839 840 +1
============================================
Files 72 72
Lines 2489 2485 -4
Branches 259 260 +1
============================================
- Hits 2076 2070 -6
- Misses 287 289 +2
Partials 126 126
Continue to review full report at Codecov.
|
Description
Fix input encoding and error parsing for HTTP calls.
Issue reference
We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.
Please reference the issue this PR will close: #427
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: